package com.training.api.service;

import com.training.api.repository.FeedbackRepository;
import com.training.bean.Feedback;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class FeedbackService {

    @Autowired
    private FeedbackRepository repository;

    /**
     * 保存意见反馈
     * @param uid 用户ID
     * @param content 反馈内容
     * @return 保存后的Feedback对象
     */
    public Feedback saveFeedback(int uid, String content) {
        Feedback feedback = new Feedback();
        feedback.setUid(uid);
        feedback.setContent(content);
        feedback.setCreate_date(new Date());
        return repository.save(feedback);
    }
}